package com.corpgovernment.organization.vo.budget;

import com.corpgovernment.common.annotation.OperateLogFieldDesc;
import com.corpgovernment.organization.enumm.budget.BudgetChangeEnum;
import com.corpgovernment.organization.enumm.budget.BudgetScopeEnum;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import javax.validation.Valid;
import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;

@Getter
@Setter
public class AddBudgetLogVo {
	/**
	 * 公司
	 */
	@OperateLogFieldDesc(value = "公司")
	private String corpName;

	/**
	 * 开始时间 -- 追加可不传
	 */
	@OperateLogFieldDesc(value = "预算开始时间")
	private String startTime;

	/**
	 * 结束时间 -- 追加可不传
	 */
	@OperateLogFieldDesc(value = "预算结束时间")
	private String endTime;

	/**
	 * 1-按部门，2-按成本中心 -- 追加可不传
	 */
	@OperateLogFieldDesc(value = "预算范围类型", type = BudgetScopeEnum.class, desc = "getName")
	private String rangeType;

	/**
	 * 部门选择结果 -- 追加可不传
	 */
	@Valid
	@OperateLogFieldDesc(value = "预算范围")
	private List<String> departmentNameList;

	/**
	 * 预算总金额
	 */
	@NotNull(message = "预算总金额不能为空")
	@DecimalMin(value = "0", message = "预算总金额不能为负数")
	@DecimalMax(value = "999999999.99", message = "预算总金额超过上限")
	@OperateLogFieldDesc(value = "预算总额")
	private BigDecimal budgetAmount;

	/**
	 * 预算告警阀值
	 */
	@NotNull(message = "预算告警阀值不能为空")
	@DecimalMin(value = "0", message = "预算告警阀值不能为负")
	@DecimalMax(value = "99.99", message = "预算告警阀值超过上限")
	@OperateLogFieldDesc(value = "预算告警阀值")
	private String alarmThresholdStr;

	/**
	 * 预算类型大对象
	 */
	@NotEmpty(message = "预算类型不能为空")
	@Valid
	@OperateLogFieldDesc(value = "预算类型", parseClass = true)
	private List<BudgetTypeVoLog> budgetTypeVoLogs;

	/**
	 * 是否短信通知
	 */
	@OperateLogFieldDesc(value = "短信通知", parseClass = true)
	private String sendMsgStr;

	/**
	 * 短信通知
	 */
	@Valid
	@OperateLogFieldDesc(value = "通知范围", parseClass = true)
	private List<NotifyScopeVo> notifyScope;

	@OperateLogFieldDesc(value = "状态", type = BudgetChangeEnum.class)
	private Integer status;

	@Data
	public static class BudgetTypeVoLog {

		@Valid
		@OperateLogFieldDesc(value = "产线名称")
		private List<String> typeNames;

		/**
		 * 金额
		 */
		@NotNull(message = "预算金额不能为空")
		@DecimalMin(value = "0", message = "预算金额不能为负数")
		@DecimalMax(value = "999999999.99", message = "预算金额超过上限")
		@OperateLogFieldDesc(value = "预算金额")
		private BigDecimal amount;

		/**
		 * 告警阀值
		 */
		@NotNull(message = "预算告警阀值不能为空")
		@DecimalMin(value = "0", message = "预算告警阀值不能为负")
		@DecimalMax(value = "99.99", message = "预算告警阀值超过上限")
		@OperateLogFieldDesc(value = "预算告警阀值")
		private String thresholdStr;

		/**
		 * 是否全部
		 */
		private boolean ifAll;
	}

}